#include <iostream>
#include <cmath>

using namespace std;

double calcInterest(double P, double r, int n, int t)
{
	double I = 0;

	I = P*(pow((1 + r / n),(t * n))) - P ;  

	return I;

}

void CDcalculator()
{	
	double I;
	double P;
	double r;
	int n;
    int t;

	cout << "Welcome to Certificates Deposit Calculator" << endl;
	cout << "Programmed By Yatwa Ng" << endl;

	cout << "" << endl;

	cout << "The Principle of the CD (ex. 1000.00): ";
	cin >> P;

	cout << "The Annual Interest Rate (e.g. 0.07 for 7%): ";
	cin >> r;

	cout << "The Number of Compounding Periods in a year: ";
	cin >> n;
    
    cout << "The Term of the CD in years: ";
	cin >> t;

	I = calcInterest(P,r,n,t);

	cout << "The Accured Intrest: " << I << endl;

	

	

	system("PAUSE");

}
